package 知识要点;

public class 方法的递归 {
       public static void main(String[] args) {
		int sum=getSum(100);
		System.out.println("sum="+sum);
	}

	private static int getSum(int n) {
		//下面实现1到n的求和
	   if(n==1){
		   //满足条件，递归返回
		   return 1;
	   }
	   int temp=getSum(n-1);
	   int ss=temp+n;
	   System.out.println(ss);
		return temp+n;
	}
}